#include<stdio.h>

int gcd_iter(int u, int v) {
  if (u < 0) u = -u;
  if (v < 0) v = -v;
  if (v) while ((u %= v) && (v %= u));
  return (u + v);
}

int gcd_rec(int u, int v) {
  return (v != 0)?gcd_rec(v, u%v):u;
}

int main() {
    printf("%d\n", gcd_iter(399, -3999));
    printf("%d\n", gcd_rec(399, -3999));
    return 0;
}
